import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
import javax.swing.event.*;
import javax.swing.border.*;
import java.util.*;

public class InstrumentSelectorPanel extends JPanel {
    private JSClient client;
    
    public InstrumentSelectorPanel(JSClient aClient) {
        this.client = aClient;
        
        JButton piano_btn = new JButton("Piano");
        JButton drums_btn = new JButton("Drums");
        JButton guitar_btn = new JButton("Guitar");
        
        piano_btn.addActionListener( new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                client.getUser().setInstrument("piano");
            }
        });

        drums_btn.addActionListener( new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                client.getUser().setInstrument("steel drums");
            }
        });
        
        guitar_btn.addActionListener( new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                client.getUser().setInstrument("guitar");
            }
        });
        
        // set instrument selection button icon images
        piano_btn.setIcon(new ImageIcon("images\\keyboardicon.jpg"));
        drums_btn.setIcon(new ImageIcon("images\\drumsicon.jpg"));
        guitar_btn.setIcon(new ImageIcon("images\\guitaricon.jpg"));
        
        this.setLayout(new GridLayout(3, 1));
        this.add(piano_btn);
        this.add(drums_btn);
        this.add(guitar_btn);
        
        TitledBorder selectionBorder = BorderFactory.createTitledBorder("Instruments");
        selectionBorder.setTitleJustification(TitledBorder.CENTER);
        this.setBorder(selectionBorder);
        //this.pack();
    }
}
